package com.shenmazong.servereduuser.controller;

import com.shenmazong.servereduuser.entity.TbRole;
import com.shenmazong.servereduuser.service.TbRoleService;
import com.shenmazong.utils.ResultResponse;
import com.shenmazong.vo.BatchChooseIdVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @author GuanJiaHe
 * @version 1.0
 * @description TODO
 * @date 2021/9/22 20:29
 */
@Api(tags = {"角色API接口"})
@RestController
@RequestMapping(value = "/role")
public class TbRoleController {

    @Autowired
    private TbRoleService roleService;

    @ApiOperation(value="增加角色", notes="增加角色", produces="application/json")
    @PostMapping("addRole")
    public ResultResponse addRole(@RequestBody TbRole tbRole){
        return roleService.addRole(tbRole);
    }

    @ApiOperation(value="删除角色", notes="删除角色", produces="application/json")
    @DeleteMapping("deleteRole")
    public ResultResponse deleteRole(@RequestBody BatchChooseIdVo idVo){
        return roleService.deleteRole(idVo);
    }

    @ApiOperation(value="获取角色信息", notes="获取角色信息", produces="application/json")
    @PostMapping("getOneRole")
    public ResultResponse getOneRole(@RequestBody TbRole tbRole){
        return roleService.getOneRole(tbRole);
    }

    @ApiOperation(value="修改角色信息", notes="修改角色信息", produces="application/json")
    @PostMapping("updateRole")
    public ResultResponse updateRole(@RequestBody TbRole tbRole){
        return roleService.updateRole(tbRole);
    }
}
